home *** CD-ROM | disk | FTP | other *** search
/ InterCD 1999 July / july_1999.iso / Site Building / HTML Notes / htmnotes.exe / file0005.bin < prev    next >
Encoding:
Text File  |  1999-06-27  |  30.5 KB  |  934 lines

  1. <!DOCTYPE PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>Clean up your Web pages with HTML TIDY</title>
  5. <meta name="keywords" content=
  6. "HTML, validation, error correction, pretty-printing">
  7. <meta name="author" content="Dave Raggett <dsr@w3.org>">
  8. <style>
  9.   body { 
  10.     margin-left: 10%; 
  11.     margin-right: 10%; 
  12.     font-family: sans-serif
  13.   }
  14.   h1 { margin-left: -8% }
  15.   h2,h3,h4,h5,h6 { margin-left: -4% }
  16.   pre { color: green; font-weight: bold; font-size: 80%; font-family: monospace}
  17.   em { font-style: italic; color: rgb(0, 0, 153) }
  18.   strong { text-transform: uppercase; font-weight: bold }
  19.   .note {font-style: italic; color: rgb(192, 101, 101) }
  20.   //hr {text-align: center; width: 60% }
  21.   blockquote {
  22.     color: navy;
  23.     margin-left: 1%;
  24.     margin-right: 1%;
  25.     text-align: center;
  26.     font-family: "Comic Sans MS", "Times New Roman", serif
  27.   }
  28.   table {
  29.     font-family: sans-serif;
  30.     font-size: 80%;
  31.     background: rgb(255,255,153)
  32.   }
  33.   td {
  34.     font-size: 80%
  35.   }
  36.   .people {font-family: "Lucida Calligraphy", serif}
  37.   :link { color: rgb(0, 0, 153) }
  38.   :visited { color: rgb(153, 0, 153) }
  39.   :active { color: rgb(255, 0, 102) }
  40.   :hover { color: rgb(0, 0, 255) }
  41. </style>
  42. </head>
  43. <body bgcolor="#FFFFE0" background="grid.gif" text="black" link= 
  44. "navy" vlink="black" alink="red">
  45. <h1 align="center"><img src="tidy.gif" width="32" height="32"
  46. align="top" alt="icon"> Clean up your Web pages<br>
  47.  with HTML TIDY</h1>
  48.  
  49. <p align="center"><small>Copyright ⌐ 1999 <a href= 
  50. "http://www.w3.org">W3C</a>, see <a href="tidy.c">tidy.c</a> for
  51. copyright notice.</small></p>
  52.  
  53. <blockquote>With many thanks to <a href="http://www.hp.com">
  54. Hewlett Packard</a> for financial support during the development
  55. of this software!</blockquote>
  56.  
  57. <p align="center"><b>This version 15th April 1999</b></p>
  58.  
  59. <p>See the <a href="release-notes.html"><b>release notes</b></a>
  60. for information on recent changes.</p>
  61.  
  62. <p>To get the latest version of Tidy please visit the original
  63. version of this page at: <a href= 
  64. "http://www.w3.org/People/Raggett/tidy">
  65. http://www.w3.org/People/Raggett/tidy</a>. Courtesy of Netmind,
  66. you can register for email reminders when new versions of tidy
  67. become available.</p>
  68.  
  69. <form method="GET" action= 
  70. "http://www.netmind.com/cgi-bin/uncgi/url-mind">
  71. <center><input type="SUBMIT" value="Press Here to Register">
  72. </center>
  73. </form>
  74.  
  75. <hr align="center" width="80%">
  76. <p align="center"><a href="#help">How to use Tidy</a> | <a href= 
  77. "#download">Downloading Tidy</a> | <a href="release-notes.html">
  78. Release Notes</a><br>
  79. <a href="#quotes">Integration with other Software</a> | <a href= 
  80. "#acks">Acknowledgements</a></p>
  81.  
  82. <hr align="center" width="80%">
  83. <h3>Introduction to TIDY</h3>
  84.  
  85. <p>When editing HTML it's easy to make mistakes. Wouldn't it be
  86. nice if there was a simple way to fix these mistakes
  87. automatically and tidy up sloppy editing into nicely layed out
  88. markup? Well now there is! Dave Raggett's HTML TIDY is a free
  89. utility for doing just that. It also works great on the
  90. atrociously hard to read markup generated by specialized HTML
  91. editors and conversion tools, and can help you identify where you
  92. need to pay further attention on making your pages more
  93. accessible to people with disabilities.</p>
  94.  
  95. <p>Tidy is able to fix up a wide range of problems and to bring
  96. to your attention things that you need to work on yourself. Each
  97. item found is listed with the line number and column so that you
  98. can see where the problem lies in your markup. Tidy won't
  99. generate a cleaned up version when there are problems that it
  100. can't be sure of how to handle. These are logged as "errors"
  101. rather than "warnings".</p>
  102.  
  103. <h3>Examples of TIDY at work</h3>
  104.  
  105. <p>Tidy corrects the markup in a way that matches where possible
  106. the observed rendering in popular browsers from Netscape and
  107. Microsoft. Here are just a few examples of how TIDY perfects your
  108. HTML for you:</p>
  109.  
  110. <ul>
  111. <li><b>Missing or mismatched end tags are detected and
  112. corrected</b> 
  113.  
  114. <pre>
  115.    <h1>heading
  116.    <h2>subheading</h3>
  117. </pre>
  118.  
  119. <p>is mapped to</p>
  120.  
  121. <pre>
  122.    <h1>heading</h1>
  123.    <h2>subheading</h2>
  124. </pre>
  125. </li>
  126.  
  127. <li><b>End tags in the wrong order are corrected:</b> 
  128.  
  129. <pre>
  130.    <p>here is a para <b>bold <i>bold italic</b> bold?</i> normal?
  131. </pre>
  132.  
  133. <p>is mapped to</p>
  134.  
  135. <pre>
  136.    <p>here is a para <b>bold <i>bold italic</i> bold?</b> normal?
  137. </pre>
  138. </li>
  139.  
  140. <li><b>Fixes problems with heading emphasis</b> 
  141.  
  142. <pre>
  143.    <h1><i>italic heading</h1>
  144.    <p>new paragraph
  145. </pre>
  146.  
  147. <p>In Netscape and Internet Explorer this causes everything
  148. following the heading to be in the heading font size, not the
  149. desired effect at all!</p>
  150.  
  151. <p>Tidy maps the example to</p>
  152.  
  153. <pre>
  154.    <h1><i>italic heading</i></h1>
  155.    <p>new paragraph
  156. </pre>
  157. </li>
  158.  
  159. <li><b>Recovers from mixed up tags</b> 
  160.  
  161. <pre>
  162.    <i><h1>heading</h1></i>
  163.    <p>new paragraph <b>bold text
  164.    <p>some more bold text
  165. </pre>
  166.  
  167. <p>Tidy maps this to</p>
  168.  
  169. <pre>
  170.    <h1><i>heading</i></h1>
  171.    <p>new paragraph <b>bold text</b>
  172.    <p><b>some more bold text</b>
  173. </pre>
  174. </li>
  175.  
  176. <li><b>Getting the <hr> in the right place:</b> 
  177.  
  178. <pre>
  179.    <h1><hr>heading</h1>
  180.    <h2>sub<hr>heading</h2>
  181. </pre>
  182.  
  183. <p>Tidy maps this to</p>
  184.  
  185. <pre>
  186.    <hr>
  187.    <h1>heading</h1>
  188.    <h2>sub</h2>
  189.    <hr>
  190.    <h2>heading</h2>
  191. </pre>
  192. </li>
  193.  
  194. <li><b>Adding the missing "/" in end tags for anchors:</b> 
  195.  
  196. <pre>
  197.    <a href="#refs">References<a>
  198. </pre>
  199.  
  200. <p>Tidy maps this to</p>
  201.  
  202. <pre>
  203.    <a href="#refs">References</a>
  204. </pre>
  205. </li>
  206.  
  207. <li><b>Perfecting lists by putting in tags missed out:</b> 
  208.  
  209. <pre>
  210.    <body>
  211.    <li>1st list item
  212.    <li>2nd list item
  213. </pre>
  214.  
  215. <p>is mapped to</p>
  216.  
  217. <pre>
  218.    <body>
  219.    <ul>
  220.    <li>1st list item</li>
  221.    <li>2nd list item</li>
  222.    </ul>
  223. </pre>
  224. </li>
  225.  
  226. <li><b>Missing quotes around attribute values are added</b> 
  227.  
  228. <p>Tidy inserts quote marks around all attribute values for you.
  229. It can also detect when you have forgotten the closing quote
  230. mark, although this is something you will have to fix
  231. yourself.</p>
  232. </li>
  233.  
  234. <li><b>Unknown/Proprietary attributes are reported</b> 
  235.  
  236. <p>Tidy has a comprehensive knowledge of the attributes defined
  237. in the HTML 4.0 recommendation from W3C. This often allows you to
  238. spot where you have mistyped an attribute or value.</p>
  239. </li>
  240.  
  241. <li><b>Proprietary elements are recognized and reported as
  242. such.</b> 
  243.  
  244. <p>Tidy will even work out which version of HTML you are using
  245. and insert the appropriate DOCTYPE element, as per the W3C
  246. recommendations.</p>
  247. </li>
  248.  
  249. <li><b>Tags lacking a terminating '>' are spotted</b> 
  250.  
  251. <p>This is something you then have to fix yourself as Tidy is
  252. unsure of where the > should be inserted.</p>
  253. </li>
  254. </ul>
  255.  
  256. <h3>Layout style</h3>
  257.  
  258. <p>You can choose which style you want Tidy to use when it
  259. generates the cleaned up markup: for instance whether you like
  260. elements to indent their contents or not.</p>
  261.  
  262. <h3>Internationalization issues</h3>
  263.  
  264. <p>Tidy offers you a choice of character encodings: US ASCII, ISO
  265. Latin-1, UTF-8 and the ISO 2022 family of 7 bit encodings. The
  266. full set of HTML 4.0 entities are defined. Cleaned up output uses
  267. HTML entity names for characters when appropriate. Otherwise
  268. characters outside the normal range are output as numeric
  269. character entities.</p>
  270.  
  271. <h3>Accessibility</h3>
  272.  
  273. <p>Tidy offers advice on accessibility problems for people using
  274. non-graphical browsers. The most common thing you will see is the
  275. suggestion you add a summary attribute to table elements. The
  276. idea is to provide a summary of the table's role and structure
  277. suitable for use with aural browsers.</p>
  278.  
  279. <h3>Cleaning up presentational markup</h3>
  280.  
  281. <p>Many tools generate HTML with an excess of FONT, NOBR and
  282. CENTER tags. Tidy's <em>-clean</em> option will replace them by
  283. style properties and rules using CSS. This makes the markup
  284. easier to read and maintain as well as reducing the file size!
  285. Tidy is expected to get smarter at this in the future.</p>
  286.  
  287. <h3>Support for XML</h3>
  288.  
  289. <p>XML processors compliant with W3C's XML 1.0 recommendation are
  290. very picky about which files they will accept. Tidy can help you
  291. to fix errors that cause your XML files to be rejected. Tidy
  292. doesn't yet recognize all XML features though, e.g. it doesn't
  293. yet understand CDATA sections or DTD subsets.</p>
  294.  
  295. <h3>Creating Slides</h3>
  296.  
  297. <p>The <em>-slides</em> option allows you to burst a single HTML
  298. file into a number of linked slides. Each H2 element in the input
  299. file is treated as delimiting the start of the next slide. The
  300. slides are named slide1.html, slide2.html, slide3.html etc. This
  301. is a relatively new feature and ideas are welcomed as to how to
  302. improve it. In particular, I plan to add support to the
  303. configuration file for setting the style sheet for slides and for
  304. customizing the slides via a template.</p>
  305.  
  306. <p>I would be interested in hearing from anyone who can offer
  307. help with using Javascript for adding dynamic effects to slides,
  308. for instance similar to those available in Microsoft
  309. PowerPoint.</p>
  310.  
  311. <h3>Indenting text for a better layout</h3>
  312.  
  313. <pre>
  314.  <html>
  315.    <head>
  316.    </head>
  317.    <body>
  318.      <p>
  319.        para which has enough text to cause a line break, and so test
  320.        the wrapping mechanism for long lines.
  321.      </p>
  322.  <pre>This is
  323.  <em>genuine
  324.        preformatted</em>
  325.     text
  326.  </pre>
  327.      <ul>
  328.        <li>
  329.          1st list item 
  330.        </li>
  331.        <li>
  332.          2nd list item
  333.        </li>
  334.      </ul>
  335.      <!-- end comment -->
  336.    </body>
  337.  </html>
  338. </pre>
  339.  
  340. <p>and this is the default style:</p>
  341.  
  342. <pre>
  343.  <html>
  344.  <head>
  345.  </head>
  346.  <body>
  347.  <p>para which has enough text to cause a line break, and so test
  348.  the wrapping mechanism for long lines.</p>
  349.  
  350.  <pre>This is
  351.  <em>genuine
  352.        preformatted</em>
  353.     text
  354.  </pre>
  355.  
  356.  <ul>
  357.  <li>1st list item </li>
  358.  
  359.  <li>2nd list item</li>
  360.  </ul>
  361.  
  362.  <!-- end comment -->
  363.  </body>
  364.  </html>
  365.  
  366. </pre>
  367.  
  368. <h3><a name="help">How to run tidy</a></h3>
  369.  
  370. <pre>
  371.    <font color=
  372. "maroon">tidy</font> <em>[[options] filename]*</em>
  373. </pre>
  374.  
  375. <p>HTML tidy is not (yet) a windows program. If you run tidy
  376. without any arguments, it will just sit there waiting to read
  377. markup on the stdin stream. Tidy's input and output default to
  378. stdin and stdout respectively. Errors are written to stderr but
  379. can be redirected to a file with the -f <em>filename</em>
  380. option.</p>
  381.  
  382. <p>I generally use the -m option to get tidy to update the
  383. original file, and if the file is particularly bad I also use the
  384. -f option to write the errors to a file to make it easier to
  385. review them. Tidy supports a small set of character encoding
  386. options. The default is ASCII, which makes it easy to edit markup
  387. in regular text editors.</p>
  388.  
  389. <p>For instance:</p>
  390.  
  391. <pre>
  392.    tidy -f errs.txt -m index.html
  393. </pre>
  394.  
  395. <p>which runs tidy on the file "index.html" updating it in place
  396. and writing the error messages to the file "errs.txt". Its a good
  397. idea to save your work before tidying it, as with all complex
  398. software, tidy may have bugs. If you find any please let me
  399. know!</p>
  400.  
  401. <p>Users running in Microsoft Windows should be aware that Dos
  402. doesn't expand wild cards in filenames. This means that if you
  403. have several html files in the same directory and want to tidy
  404. all of them:</p>
  405.  
  406. <pre>
  407.    tidy *.html
  408. </pre>
  409.  
  410. <p>won't work. You will see an error message: "can't open file
  411. *.html". Instead you need to run tidy separately on each one. I
  412. will look into a fix for this for a future release. A work around
  413. is to use the DOS <em>for</em> command, as in:</p>
  414.  
  415. <pre>
  416.         for %i in (*.html) do tidy %i
  417. </pre>
  418.  
  419. <p>Note: in a batch file that needs to be %%i instead of %i</p>
  420.  
  421. <h4>Tidy's Options</h4>
  422.  
  423. <p>To get a list of available options use:</p>
  424.  
  425. <pre>
  426.    tidy -help
  427. </pre>
  428.  
  429. <p>You should see something like this:</p>
  430.  
  431. <pre>
  432.    options for tidy vers: 14th April 1999
  433.  
  434.    <font color=
  435. "maroon">-config <em>file</em></font>        read config <em>file</em>
  436.    <font color="maroon">-indent</font> <i>or</i> <font color= 
  437. "maroon">-i</font>       indent element content
  438.    <font color="maroon">-omit</font> <i>or</i> <font color=
  439. "maroon">-o</font>         omit optional endtags
  440.    <font color=
  441. "maroon">-wrap 72</font>            wrap text at column 72 (default is 68)
  442.    <font color="maroon">-upper</font> <i>or</i> <font color= 
  443. "maroon">-u</font>        force tags to upper case
  444.    <font color="maroon">-clean</font> <i>or</i> <font color= 
  445. "maroon">-c</font>        replace font, nobr &amp; center tags by CSS
  446.    <font color=
  447. "maroon">-raw</font>                don't o/p entities for chars 128 to 255
  448.    <font color=
  449. "maroon">-ascii</font>              use ASCII for output, Latin-1 for input
  450.    <font color=
  451. "maroon">-latin1</font>             use Latin-1 for both input and output
  452.    <font color=
  453. "maroon">-utf8</font>               use UTF-8 for both input and output
  454.    <font color=
  455. "maroon">-iso2022</font>            use ISO2022 for both input and output
  456.    <font color="maroon">-numeric</font> <i>or</i> <font color= 
  457. "maroon">-n</font>      output numeric rather than named entities
  458.    <font color="maroon">-modify</font> <i>or</i> <font color= 
  459. "maroon">-m</font>       to modify original files
  460.    <font color="maroon">-errors</font> <i>or</i> <font color= 
  461. "maroon">-e</font>       show only error messages
  462.    <font color=
  463. "maroon">-f <em>file</em></font>             write errors to <em>file</em>
  464.    <font color=
  465. "maroon">-xml</font>                use this when input is in XML
  466.    <font color=
  467. "maroon">-asxml</font>              to convert HTML to XML
  468.    <font color=
  469. "maroon">-slides</font>             to burst into slides on h2 elements
  470.    <font color=
  471. "maroon">-help</font>               list command line options
  472. </pre>
  473.  
  474. <p>Input and Output default to stdin/stdout respectively. Single
  475. letter options apart from -f may be combined as in: tidy -f
  476. errs.txt -imu foo.html</p>
  477.  
  478. <h3><a name="config">Using a Configuration File</a></h3>
  479.  
  480. <p>Tidy now supports a configuration file, and this is now much
  481. the most convenient way to configure Tidy. Assuming you have
  482. created a config file named "config.txt" (the name doesn't
  483. matter), you can instruct Tidy to use it via the command line
  484. option <tt>-config config.txt</tt>, e.g.</p>
  485.  
  486. <pre>
  487.    tidy -config config.txt file1.html file2.html
  488. </pre>
  489.  
  490. <p>Alternatively, you can name the default config file via the
  491. environment variable named "HTML_TIDY". Note this should be the
  492. absolute path since you are likely to want to run Tidy in
  493. different directories.</p>
  494.  
  495. <p>The following options are supported:</p>
  496.  
  497. <dl>
  498. <dt>markup: <em>bool</em></dt>
  499.  
  500. <dd>Determines whether Tidy generates a pretty printed version of
  501. the markup. Bool values are either <em>yes</em> or <em>no</em>.
  502. Note that Tidy won't generate a pretty printed version if it
  503. finds unknown tags, or missing trailing quotes on attribute
  504. values, or missing trailing '>' on tags. The default is <em>
  505. no</em>.</dd>
  506.  
  507. <dt>wrap: <em>number</em></dt>
  508.  
  509. <dd>Sets the right margin beyond which Tidy attempts to wrap
  510. lines so as to get them to fit within this margin. The default is
  511. column 66.</dd>
  512.  
  513. <dt>tab-size: <em>number</em></dt>
  514.  
  515. <dd>Sets the number of columns between successive tab stops. The
  516. default is 4. It is used to map tabs to spaces when reading
  517. files. Tidy never outputs files with tabs.</dd>
  518.  
  519. <dt>indent: <em>no, yes</em> or <em>auto</em></dt>
  520.  
  521. <dd>If set to <em>yes</em> Tidy will indent block-level tags. The
  522. default is <em>no</em>. If set to <em>auto</em> Tidy will decide
  523. whether or not to indent the content of tags such as h1-h6, li,
  524. or p depending on whether or not the content includes a
  525. block-level element.</dd>
  526.  
  527. <dt>indent-spaces: <em>number</em></dt>
  528.  
  529. <dd>Sets the number of spaces to indent content when indentation
  530. is enabled. The default is 2 spaces.</dd>
  531.  
  532. <dt>hide-endtags: <em>bool</em></dt>
  533.  
  534. <dd>If set to <em>yes</em>, optional end-tags will be omitted
  535. when generating the pretty printed markup. This option is ignored
  536. if you are outputting to XML. The default is <em>no</em>.</dd>
  537.  
  538. <dt>input-xml: <em>bool</em></dt>
  539.  
  540. <dd>If set to <em>yes</em>, Tidy will use the XML parser rather
  541. than the error correcting HTML parser. The default is <em>
  542. no</em>.</dd>
  543.  
  544. <dt>output-xml: <em>bool</em></dt>
  545.  
  546. <dd>If set to <em>yes</em>, Tidy will use generate the pretty
  547. printed output writing it as well-formed XML. Any entities not
  548. defined in XML 1.0 will be written as numeric entities to allow
  549. them to be parsed by an XML parser. The default is <em>
  550. no</em>.</dd>
  551.  
  552. <dt>output-xhtml: <em>bool</em></dt>
  553.  
  554. <dd>If set to <em>yes</em>, Tidy will use generate the pretty
  555. printed output writing it as extensible HTML. The default is <em>
  556. no</em>. This option causes Tidy to set the doctype and default
  557. namespace as appropriate to XHTML. If a doctype or namespace is
  558. given they will checked for consistency with the content of the
  559. document. In the case of an inconsistency, the corrected values
  560. will appear in the output. For XHTML, entities can be written as
  561. named or numeric entities according to the value of the
  562. "numeric-entities" property.</dd>
  563.  
  564. <dt>char-encoding: <em>raw, ascii, latin1, utf8</em> or <em>
  565. iso2022</em></dt>
  566.  
  567. <dd>Determines how Tidy interprets character streams. For <em>
  568. ascii</em>, Tidy will accept Latin-1 character values, but will
  569. use entities for all characters whose value > 127. For <em>
  570. raw</em>, Tidy will output values above 127 without translating
  571. them into entities. For <em>latin1</em> characters above 255 will
  572. be written as entities. For <em>utf8</em>, Tidy assumes that both
  573. input and output is encoded as UTF-8. You can use <em>
  574. iso2022</em> for files encoded using the ISO2022 family of
  575. encodings e.g. ISO 2022-JP. The default is <em>ascii</em></dd>
  576.  
  577. <dt>numeric-entities: <em>bool</em></dt>
  578.  
  579. <dd>Causes entities other than the basic XML 1.0 named entities
  580. to be written in the numeric rather than the named entity form.
  581. The default is <em>no</em></dd>
  582.  
  583. <dt>quote-marks: <em>bool</em></dt>
  584.  
  585. <dd>If set, this causes " characters to be written out as
  586. &amp;quot; as is preferred by some editing environments. The
  587. default is <em>no</em>.</dd>
  588.  
  589. <dt>quote-nbsp: <em>bool</em></dt>
  590.  
  591. <dd>If set, this causes non-breaking space characters to be
  592. written out as enities. The default is <em>yes</em>.</dd>
  593.  
  594. <dt>quote-marks: <em>bool</em></dt>
  595.  
  596. <dd>If set, this causes unadorned &amp; characters to be
  597. written out as &amp;. The default is <em>yes</em>.</dd>
  598.  
  599. <dt>wrap-script-literals: <em>bool</em></dt>
  600.  
  601. <dd>If set, this allows lines to be wrapped within string
  602. literals that appear in script attributes. The default is <em>
  603. no</em>. The example shows how Tidy wraps a really really long
  604. script string literal inserting a backslash character before the
  605. linebreak: 
  606.  
  607. <pre>
  608. <a href="somewhere.html" onmouseover="document.status = '...some \
  609. really, really, really, really, really, really, really, really, \
  610. really, really long string..';">test</a>
  611. </pre>
  612. </dd>
  613.  
  614. <dt>break-before-br: <em>bool</em></dt>
  615.  
  616. <dd>If set, Tidy will output a line break before each <br>
  617. element. The default is <em>no</em>.</dd>
  618.  
  619. <dt>uppercase-tags: <em>bool</em></dt>
  620.  
  621. <dd>Causes tag names to be output in upper case. The default is
  622. <em>no</em>.</dd>
  623.  
  624. <dt>uppercase-attributes: <em>bool</em></dt>
  625.  
  626. <dd>Causes attribute names to be output in upper case. The
  627. default is <em>no</em>.</dd>
  628.  
  629. <dt>clean: <em>bool</em></dt>
  630.  
  631. <dd>If set, causes Tidy to strip out surplus presentational tags
  632. and attributes replacing them by style rules and structural
  633. markup as appropriate. It works well on the html saved from
  634. Microsoft Office'97. I hope to work on cleaning up after Office
  635. 2000 in a future release. The default is <em>no</em>.</dd>
  636.  
  637. <dt>write-back: <em>bool</em></dt>
  638.  
  639. <dd>If set, Tidy will write back the tidied markup to the same
  640. file it read from. The default is <em>no</em>. You are advised to
  641. keep copies of important files before tidying them as on rare
  642. occasions the result may not always be what you expect.</dd>
  643.  
  644. <dd>error-file: <em>filename</em></dd>
  645.  
  646. <dd>Writes errors and warnings to the specified file rather than
  647. to stderr.</dd>
  648.  
  649. <dt>show-warnings: <em>bool</em></dt>
  650.  
  651. <dd>If set to no, warnings are suppressed. This can be useful
  652. when a few errors are hidden in a flurry of warnings. The default
  653. is <em>yes</em>.</dd>
  654.  
  655. <dt>split: <em>bool</em></dt>
  656.  
  657. <dd>If set to <em>yes</em> Tidy will use the input file to create
  658. a sequence of slides, splitting the markup prior to each
  659. successive <h2>. You can see an example of the results in a
  660. <a href="http://www.w3.org/Talks/1999/03/23-stockholm-xhtml">
  661. recent talk I made on XHTML</a>. The slides are written to
  662. "slide1.html", "slide2.html" etc. The default is <em>
  663. no</em>.</dd>
  664.  
  665. <dt>new-inline-tags: <em>tag1, tag2, tag3</em></dt>
  666.  
  667. <dd>Use this to declare new inline tags. The option takes a space
  668. or comma separated list of tag names. Unless you declare new
  669. tags, Tidy will refuse to generate a tidied file if the input
  670. includes previously unknown tags.</dd>
  671.  
  672. <dt>new-blocklevel-tags: <em>tag1, tag2, tag3</em></dt>
  673.  
  674. <dd>Use this to declare new block-level tags. The option takes a
  675. space or comma separated list of tag names. Unless you declare
  676. new tags, Tidy will refuse to generate a tidied file if the input
  677. includes previously unknown tags.</dd>
  678. </dl>
  679.  
  680. <h4>Sample Config File</h4>
  681.  
  682. <pre>
  683. // sample config file for HTML tidy
  684. indent: auto
  685. indent-spaces: 2
  686. wrap: 72
  687. markup: yes
  688. clean: yes
  689. output-xml: no
  690. input-xml: no
  691. show-warnings: yes
  692. numeric-entities: yes
  693. quote-marks: yes
  694. quote-nbsp: yes
  695. quote-ampersand: no
  696. break-before-br: no
  697. uppercase-tags: no
  698. uppercase-attributes: no
  699. output-xhtml: yes
  700. char-encoding: latin1
  701. </pre>
  702.  
  703. <h3><a name="download">Downloadable Binaries</a></h3>
  704.  
  705. <p class="note">If you are prepared to maintain a public URL for
  706. HTML Tidy compiled for a specific platform, please let me know so
  707. that I can add a link to your page. This will avoid the need for
  708. me to update this page whenever you recompile.</p>
  709.  
  710. <p><b><a href="http://www.chami.com/free/html-kit/">Windows
  711. users</a></b>! A free graphical user interface (HTML-Kit) for
  712. HTML Tidy is now available for windows 95/98/NT. Alternatively,
  713. you can get tidy in its native form as a Windows console program:
  714. <a href="http://www.w3.org/People/Raggett/tidy.exe"><b>
  715. tidy.exe</b></a>, with the command options as per above.</p>
  716.  
  717. <p><b><a href= 
  718. "http://www.geocities.com/SiliconValley/1057/tidy.html">Mac
  719. users</a></b>! You can now run <a href= 
  720. "http://www.geocities.com/SiliconValley/1057/tidy.html">HTML Tidy
  721. with FilterTop</a> (<a href= 
  722. "http://www.geocities.com/SiliconValley/1057/images/TidyHTML.GIF">
  723. Screenshot</a>), or as a command line interface application. My
  724. thanks to <a href="mailto:teague@macbroker.com">Terry Teague</a>
  725. for this port.</p>
  726.  
  727. <p><b><a href=
  728. "http://www.amiga.u-net.com/MadDogSoftware/Tidy.html">Amiga
  729. users</a></b>! Keith Blakemore-Noble has compiled Tidy for the
  730. Amiga.</p>
  731.  
  732. <p><b><a href= 
  733. "http://www-frec.bull.com/cgi-bin/list_dir.cgi/download/">AIX
  734. executable for Tidy</a></b>! Compiled by Ciaran Deignan. The link
  735. is to a general download page. The executable is available for
  736. AIX 4.3.2 and later.</p>
  737.  
  738. <h3><a name="quotes">Integrating Tidy as part of other
  739. Software</a></h3>
  740.  
  741. <p>You can also incorporate Tidy as part of a larger program, for
  742. instance in HTML editors or HTML transformation tools used for
  743. import filters, or for when you want to customize Web content
  744. to get the best out of different kinds of browsers. Imagine
  745. authoring clean HTML with CSS and at a touch of a button
  746. producing variants that look great and work reliably on a large
  747. variety of different browsers, taking into account the quirks of
  748. each. For instance, providing the ability to tune content for
  749. different versions of Netscape and Internet Explorer, and for
  750. browsers running on set-top boxes for televisions, handheld and
  751. palmtop devices, cellphones, and voice browsers. I am happy to
  752. quote for software development for such tools.</p>
  753.  
  754. <h3><a name="implementation">Implementation details</a></h3>
  755.  
  756. <p>The code is in ANSI C and uses the C standard library for i/o.
  757. The parser is thread-safe although the code for pretty printing
  758. the parse tree is not (yet). The parser works top down, building
  759. a complete parse tree in memory. Document text is held as Unicode
  760. represented as UTF-8 in a character buffer that expands as
  761. needed. The code has so far been tested on Windows'95, Windows'98,
  762. Windows NT, Linux, FreeBSD, NetBSD, Ultrix, OSF, OS/MP, IRIX,
  763. NeXtStep, MacOS, BeOS, OS2, AIX, Amiga, SunOS, Solaris, IRIX and
  764. HP-UX, amongst others.</p>
  765.  
  766. <dl>
  767. <dt><a href="../tidy15apr99.tgz">tidy15apr99.tgz</a></dt>
  768.  
  769. <dd>gzipped tar file for source code (Unix line ends)</dd>
  770.  
  771. <dt><a href="../tidy15apr99.zip">tidy15apr99.zip</a></dt>
  772.  
  773. <dd>zipped source code (Windows line ends)</dd>
  774.  
  775. <dt><a href="http://www.w3.org/People/Raggett/tidy.exe">
  776. tidy.exe</a></dt>
  777.  
  778. <dd>Windows 95/NT executable (32-bit Windows console-mode
  779. program)</dd>
  780.  
  781. <dt><a href=
  782. "http://www.w3.org/People/Raggett/tidy17dec98.ppc.tgz">
  783. tidy17dec98.ppc.tgz</a></dt>
  784.  
  785. <dd>Gzipped archive of the binary for BeOS PPC R4. It also
  786. contains complete tidy distribution and Makefile.BeOS file for
  787. BeOS (from 17dec98 release of tidy).</dd>
  788.  
  789. <dt><a href=
  790. "http://www.dd.iij4u.or.jp/~kshimz/warp/tidy/tidy.zip">Tidy on
  791. OS/2</a></dt>
  792.  
  793. <dd>Zipped archive of the OS/2 release of tidy, as compiled by
  794. Kaz SHiMZ <<a href=
  795. "mailto:kshimz@sfc.co.jp">kshimz@sfc.co.jp</a>></dd>
  796.  
  797. <dt><a href="platform.h">platform.h</a>, <a href="html.h">
  798. html.h</a></dt>
  799.  
  800. <dd>the include files with common definitions</dd>
  801.  
  802. <dt><a href="config.c">config.c</a></dt>
  803.  
  804. <dd>support for customizing Tidy via config files</dd>
  805.  
  806. <dt><a href="lexer.c">lexer.c</a></dt>
  807.  
  808. <dd>lexical analysis and buffer management</dd>
  809.  
  810. <dt><a href="parser.c">parser.c</a></dt>
  811.  
  812. <dd>HTML and XML parsers</dd>
  813.  
  814. <dt><a href="tags.c">tags.c</a></dt>
  815.  
  816. <dd>dictionary of tags and their properties</dd>
  817.  
  818. <dt><a href="attrs.c">attrs.c</a></dt>
  819.  
  820. <dd>dictionary of attributes and their properties</dd>
  821.  
  822. <dt><a href="istack.c">istack.c</a></dt>
  823.  
  824. <dd>stack of active inline elements</dd>
  825.  
  826. <dt><a href="entities.c">entities.c</a></dt>
  827.  
  828. <dd>dictionary of entities</dd>
  829.  
  830. <dt><a href="clean.c">clean.c</a></dt>
  831.  
  832. <dd>smarts for cleaning up presentational markup</dd>
  833.  
  834. <dt><a href="pprint.c">pprint.c</a></dt>
  835.  
  836. <dd>pretty printing for HTML and XML</dd>
  837.  
  838. <dt><a href="localize.c">localize.c</a></dt>
  839.  
  840. <dd>Change this file to localize tidy's messages</dd>
  841.  
  842. <dt><a href="tidy.c">tidy.c</a></dt>
  843.  
  844. <dd>main() and error reporting routines</dd>
  845.  
  846. <dt><a href="Makefile">Makefile</a></dt>
  847.  
  848. <dd>Makefile for gcc</dd>
  849. </dl>
  850.  
  851. <p>Conventions for whether lines end with CRLF, LF or CR vary
  852. from one system to another. I have included the C source for a
  853. utility <b>tab2space</b> which can be used to ensure that files
  854. use the line end convention of your choice, and to expand tabs to
  855. spaces.</p>
  856.  
  857. <pre>
  858.    tab2space -t4 -unix *.h *.c
  859.    tab2space -tabs -unix Makefile
  860. </pre>
  861.  
  862. <p>Note use of "-tabs" to ensure that tabs are preserved in the
  863. Makefile (it won't work without them!).</p>
  864.  
  865. <p>For those of you on Unix, here is a script you can use to
  866. strip carriage returns:</p>
  867.  
  868. <pre>
  869. #!/bin/sh
  870. echo Stripping Carriage Returns from files...
  871. for i
  872. do
  873.         # If a writable file
  874.         if [ -f $i ]
  875.         then
  876.                 if [ -w $i ]
  877.                 then
  878.                         echo $i
  879.                         # strip CRs from input and output to temp file
  880.                         tr -d '\015' < $i > toix.tmp
  881.                         mv toix.tmp $i
  882.                 else
  883.                         echo $i: write-protected
  884.                 fi
  885.         else
  886.                 echo $i: not a file
  887.         fi
  888. done
  889. </pre>
  890.  
  891. <p>Save this script to a file, e.g. "<em>scripcr</em>" and use
  892. "<em>chmod +x stripcr</em>" to make it executable. You can then
  893. run it as "<em>stripcr *.c *.h Overview.html Makefile</em>"</p>
  894.  
  895. <h2><a name="acks">Acknowledgements</a></h2>
  896.  
  897. <p>I would like to thank the many people who have written to me
  898. with suggestions for improvements or reporting bugs. Your help
  899. has been invaluable.</p>
  900.  
  901. <blockquote class="people">Drew Adams, Jacob Sparre Andersen,
  902. Osma Ahvenlampi, Joe D'Andrea, Jerry Andrews, Chang Hyun Baek,
  903. Chuck Baslock, Christer Bernerus, Keith Blakemore-Noble, Eric
  904. Blossom, David Brooke, Andy Brown, Keith B. Brown, Andreas
  905. Buchholz, Maurice Buxton, Jelks Cabaniss, Trevor Carden, Terry
  906. Cassidy, Mathew Cepl, Kendall Clark, Jeremy Clulow, Dan Connolly,
  907. Keith Davies, Claus AndrΘ FΣrber, Stephanie Foott, Rene Fritz,
  908. Francisco Guardiola David Getchell, Michael Giroux, Guus Goos,
  909. LΘa Gris, Francisco Guardiola, Juha HΣiki÷, G. Ken Holman, Craig
  910. Horman, Jack Horsfield, Rick Jelliffe, Craig Johnson, Charles
  911. LaFountain, Steven Lobo, Zdenek Kabelac, Michael Kay, Johannes
  912. Koch, Rudy Kohut, Allan Kuchinsky, Nick Leverton, Dietmar Lippold,
  913. Gert-Jan C. Lokhorst, Anton Marsden, Shane McCarron, Ian McKellar,
  914. Chris Nappin, Ann Navarro, Allan Odgaard, Matt Oshry, Gerald
  915. Oskoboiny, Ernst Paalvast, Christian Pantel, Steven Pemberton,
  916. Xavier Plantefeve, Ross L. Richardson, Philip Riebold, Erik Rossen,
  917. Dan Rudman, Christian Ruetgers, Klaus Johannes Rusch, Eric Schindler,
  918. J. Schlauch, Christian Schⁿler, Jim Seymour, Kazuyoshi Shimizu,
  919. Geoff Sinclair, Jo Smith, Rafi Stern, Michael J. Suzio, Oren
  920. Tirosh, John Tobler, Stuart Updegrave, Charles A. Upsdell, Larry
  921. W. Virden, Daniel Vogelheim, Jez Wain, Paul Ward, Jeff
  922. Young</blockquote>
  923.  
  924. <p><small><a href="http://www.w3.org/People/Raggett">Dave
  925. Raggett</a> <<a href="mailto:dsr@w3.org">dsr@w3.org</a>> is
  926. an engineer from <a href="http://www.hp.com/">Hewlett
  927. Packard</a>'s <a href="http://www.hpl.hp.co.uk">UK
  928. Laboratories</a>, and works on assignment to the World Wide Web
  929. Consortium, where he is the W3C lead for HTML, Math and Voice
  930. Browsers.</small></p>
  931. </body>
  932. </html>
  933.  
  934.